package com.miaomiao.domain.system;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.miaomiao.common.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@TableName(value = "sys_role")
@NoArgsConstructor
@AllArgsConstructor
public class Role extends BaseEntity {

    /** 角色ID */
    @TableId(type = IdType.AUTO)
    private Long roleId;

    /** 角色名称 */
    private String roleName;

    /** 权限字符 */
    private String roleKey;

    /** 排序 */
    private Integer roleSort;

    /** 角色状态（0正常 1停用） */
    private Boolean status;

    /** 备注*/
    private String remark;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @JsonProperty(access = JsonProperty.Access.READ_WRITE)
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    public Role(Long roleId, String roleName, String roleKey, Integer roleSort, Boolean status, String remark) {
        this.roleId = roleId;
        this.roleName = roleName;
        this.roleKey = roleKey;
        this.roleSort = roleSort;
        this.status = status;
        this.remark = remark;
    }
}
